<template>
  <div class="">
    助教管理

    <div style="width:500px;height:500px" id="main"></div>
    <!-- 第一步：定义一个用来存放图表的div 必须要设置宽高 -->
  </div>
</template>

<script>
// import echarts from "echarts";//在最新版的echarts中这么引会报错
// import * as echarts from 'echarts';
var echarts = require("echarts");
export default {
  data() {
    return {
      option: {
        title: {
          text: "微博数据统计",
          subtext: "只能作为参考",
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          orient: "vertical",
          left: "left",
        },
        series: [
          {
            name: "访问来源",
            type: "pie",
            radius: "50%",
            data: [
              { value: 500000, name: "10岁以下" },
              { value: 100000, name: "10-18岁" },
              { value: 200000, name: "18-25岁" },
              { value: 300000, name: "25-35岁" },
              { value: 80000, name: "35岁以上" },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      },
    };
  },
  mounted() {
    var chartDom = document.getElementById("main");
    //第二步 获取展示图表的容器
    var myChart = echarts.init(chartDom);

    //第三步 把图表初始化在 第二步的容器中

    myChart.setOption(this.option);
    //第四步 在图表中设置数据 option（option定义在data中）
  },
  methods: {},
  components: {},
};
</script>

<style lang="scss"></style>
